<template>
	<view class="balance-log">
		
		<view class="log-list">
				
				<view class="item" 
				:class='{"balance-red":item.num>0,"balance-green":item.num<0}'

				v-for="item in log">
					<view class="money-date">
						<view class='money'>
							余额
							<text v-if="item.num>0">增加</text>
							<text v-if="item.num<0">减少</text>
							:{{Math.abs(item.num)}}￥
						</view>
						
						<view class='date'>
							{{item.created_at}}
						</view>
					</view>
					<view class='remark'>
						{{item.remark}}
					</view>
				</view>
				<view class="nothing" v-if="cash_out.length==0">
					当前没有提现记录
				</view>
			
		</view>
		
	</view>
</template>

<script>
	const appInstance = getApp();
	export default{
		data:function(){
			
			return{
				
				log:[]
			}
		},
		
		onLoad( options ) {
			
			
			this.get_log();
		},
		
		onPullDownRefresh() {
		    console.log('refresh');
			var t = this;
		    setTimeout(function () {
				t.get_log();
		        uni.stopPullDownRefresh();
		    }, 1000);
		},
		
		methods:{
			
			get_log( ){
				
				var t = this;
				var url = '&r=balance.record';
				var data = {
					
				};
				
				appInstance.globalData.request(url, data, 'get', res=>{
					
					this.log = res.data;
					
				});
					
			}
			
		}
	}
</script>

<style lang="less">
.balance-log{
	.log-list{
		padding:0 20rpx;
		.item{
			
			
			// text-align: center;
			// height:100rpx;
			padding:10rpx 0 ;
			border-bottom:solid 1px #eee;
			
			&.balance-red{
				color:red;
			}
			&.balance-green{
				color:green;
			}
			
			.money-date{
				display:flex;
				justify-content: space-between;
				align-items: center;
				.mponey{
					
				}
				.date{
					
				}
			}
			.remark{
				margin-top:10rpx;
				color:#cdcdcd;
			}
		}
		.nothing{
			text-align:center;
			padding:100rpx 0 ;
		}
	}
}
</style>
